package com.unicloud.medical.oss.common.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

@Data
public class OSSServerProperties {
    private String name;
    private String endpoint;
    private String proxyEndpoint;
    private String accessKey;
    private String secretKey;
    private String region;
    private boolean enabled = true;
    private Check check;

    public void setName(String name) {
        this.name = StringUtils.trimToNull(name);
    }

    public void setEndpoint(String endpoint) {
        this.endpoint = StringUtils.trimToNull(endpoint);
    }

    public void setProxyEndpoint(String proxyEndpoint) {
        this.proxyEndpoint = StringUtils.trimToNull(proxyEndpoint);
    }

    public void setAccessKey(String accessKey) {
        this.accessKey = StringUtils.trimToNull(accessKey);
    }

    public void setSecretKey(String secretKey) {
        this.secretKey = StringUtils.trimToNull(secretKey);
    }

    public void setRegion(String region) {
        this.region = StringUtils.trim(region);
    }

    @Data
    @AllArgsConstructor
    public static class Check {
        private boolean enable = false;
        private String bucketName;

        public void setBucketName(String bucketName) {
            this.bucketName = StringUtils.trimToNull(bucketName);
        }
    }

}
